package routes

import (
	"github.com/bear/wolf/controller"
	"github.com/bear/wolf/middleware"
	"github.com/gin-gonic/gin"
)

func SetUpRouter() *gin.Engine{
	r := gin.Default()
	api := r.Group("api")
	{
		api.POST("/getBalance",controller.GetContractBalance)
		api.POST("/transfer",controller.TransferToContractHandler)
		api.POST("/add",controller.Adduser)
		api.POST("/login",controller.Login)
			//需要认证的路由
		auth := api.Group("auth")
		auth.Use(middleware.AuthMiddleware())
		{
			auth.GET("/myTask",controller.Mytask)
			auth.GET("/myProject",controller.MyProject)
			
			project := auth.Group("project")
			{
				project.POST("/add", controller.CreateProject)
				project.POST("/update", controller.UpdateProject)
				project.GET("/get", controller.GetOnProject)
				project.GET("/delete", controller.DeleteProjectByid)
				project.POST("/getlist", controller.GetListProject)
			}
			task := auth.Group("task")
			{
				task.POST("/add", controller.AddTask)
				task.POST("/update", controller.UpTask)
				task.GET("/get", controller.GetTaskOne)
				task.GET("/delete", controller.DeleteTaskById)
				task.GET("/getList", controller.GetTaskList)	
			}
		
		}
	}


	return r
}